package co.za.itweb.itwebpro;

import co.za.itweb.itwebpro.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class FontDialog extends Activity{

	
	
	private SeekBar seek;
	private TextView title;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		requestWindowFeature( Window.FEATURE_NO_TITLE );
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fontsize);
		 title= (TextView) findViewById(R.id.logintitle);
		 title.setTextSize(News.discrete);
		Button close = (Button) findViewById(R.id.close);
		close.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent returnIntent = new Intent();
				returnIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				setResult(1, returnIntent);
				finish();
			}
		});
		
		
		seek = (SeekBar) findViewById(R.id.slider);
		seek.setMax(15);
		
			seek.setProgress(News.discrete-15);
			
			
		

		seek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

			@Override
			public void onStopTrackingTouch(SeekBar seekBar) {
				News.discrete = seek.getProgress()+15;
				title.setTextSize(News.discrete);

			}

			@Override
			public void onStartTrackingTouch(SeekBar seekBar) {

			}

			@Override
			public void onProgressChanged(SeekBar seekBar, int progress,
					boolean fromUser) {
				
				News.discrete = progress+15;
				title.setTextSize(News.discrete);
			}
		});
	}
}
